home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
comt010d.zip
/
COMTSRC.ZIP
/
RAWENC.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-27
|
687b
|
33 lines
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
unsigned nencode_block(char *outblock, char *inblock, unsigned len);
#define IBSIZE (3*1024) /* must be divisible by 3 */
#define OBSIZE (3*2120)
int n_inbuf;
char inbuf[IBSIZE];
char outbuf[OBSIZE];
unsigned int fill_inbuf(int f)
{
n_inbuf=_read(f,inbuf,IBSIZE);
if(n_inbuf<0) return 0; else return n_inbuf;
}
main(int argc, char **argv)
{
int f;
if(argc!=2 || -1==(f=_open(argv[1],O_RDONLY|O_BINARY)))
{
fputs("RAWENC ERROR\n",stderr);
return 1;
}
nencode_block(NULL,NULL,0);
while(fill_inbuf(f))
_write(1,outbuf,nencode_block(outbuf,inbuf,n_inbuf));
_close(f);
}